#ifndef NES_INPUTMAPPER_H
#define NES_INPUTMAPPER_H
#include <stdint.h>
#include "H_NES_CPP.h"
#include <QByteArray>




class NES_InputMapper{
  public:

    void InputPress(int Index,uint32_t Button);
    void InputRelease(int Index,uint32_t Button);

    int SetKeyMapper(uint32_t KeyVal,int Index,uint32_t Button);
    int GetKeyMapper(uint32_t KeyVal,int* Index,uint32_t* Button);

    int SetKeyMapper_Array(QByteArray& mapdata);
    QByteArray GetKeyMapper_Array();

    uint32_t GetButtonPressStatus();

    NES_InputMapper();
    ~NES_InputMapper();

  private:

    struct Capture{
      int Index;
      uint32_t Button;
    };

    struct Captures{
      Capture capture[32];
    };
    

    volatile uint32_t ButtonPressStatus;

    Captures captures;

    int FindCapture(int Index,uint32_t Button);

};




#endif // NES_INPUTMAPPER_H
